package org.utils.util;
/**
 * @author Manuel EVENO
 */
public class ArrayUtils
{
	/**
	 * Constructor for ArrayUtils to avoid creating instance of this class.
	 */
	private ArrayUtils() { }
	/**
	 * Returns wheter or not the array contains the specified value.
	 * @param array The array to search into
	 * @param value The value to look for
	 * @return boolean
	 */
	public static boolean contains(Object[] array, Object value)
	{
		for (int i = 0; i < array.length; i++)
			if (array[i].equals(value))
				return true;
		return false;
	}
	/**
	 * Returns wheter or not the array contains the specified value.
	 * @param array The array to search into
	 * @param value The value to look for
	 * @return boolean
	 */
	public static boolean contains(int[] array, int value)
	{
		for (int i = 0; i < array.length; i++)
			if (array[i] == value)
				return true;
		return false;
	}
	/**
	 * Returns wheter or not the array contains the specified value.
	 * @param array The array to search into
	 * @param value The value to look for
	 * @return boolean
	 */
	public static boolean contains(long[] array, long value)
	{
		for (int i = 0; i < array.length; i++)
			if (array[i] == value)
				return true;
		return false;
	}
	/**
	 * Returns wheter or not the array contains the specified value.
	 * @param array The array to search into
	 * @param value The value to look for
	 * @return boolean
	 */
	public static boolean contains(float[] array, float value)
	{
		for (int i = 0; i < array.length; i++)
			if (array[i] == value)
				return true;
		return false;
	}
	/**
	 * Returns wheter or not the array contains the specified value.
	 * @param array The array to search into
	 * @param value The value to look for
	 * @return boolean
	 */
	public static boolean contains(char[] array, char value)
	{
		for (int i = 0; i < array.length; i++)
			if (array[i] == value)
				return true;
		return false;
	}
	/**
	 * Returns wheter or not the array contains the specified value.
	 * @param array The array to search into
	 * @param value The value to look for
	 * @return boolean
	 */
	public static boolean contains(double[] array, double value)
	{
		for (int i = 0; i < array.length; i++)
			if (array[i] == value)
				return true;
		return false;
	}
}
